<?php //$Rev:: 55         $ // DO NOT REMOVE

function stats_modStats(&$obj, $data)
{
    // get the current online timer count
    //  REQUIRES PHP 5.3.0
    $onlineTime = function() use ($obj, $data) {
        $time = $obj->core->utilities->aim_onlinetime();
        $online = ($time['days'] == 0)  ? '' : $time['days']  . ' day(s) ';
        $online.= ($time['hours'] == 0) ? '' : $time['hours'] . ' hour(s) ';
        $online.= ($time['mins'] == 0)  ? '' : $time['mins']  . ' minute(s) ';
        $online.= ($time['secs'] == 0)  ? '' : $time['secs']  . ' second(s)';
        return $online;
    };

    $count = Db::getValue('SELECT COUNT(*) as count FROM atac_messages');
    $fr = Db::getValue('SELECT firstrun FROM atac_stats');

    $text = sprintf('I have been online for <b>%s</b>, and have recieved <b>%d</b> message(s) since i was initially run on %s', $onlineTime(), $count, date('F j, Y, \@ g:i a', $fr));

    if ($data['message_type'] == AIM_MSG_CHAT) {
        $obj->core->chat->aim_chat_send($data['cid'], $text);
    } else {
        $obj->core->utilities->aim_send_im($data['screenname'], $text, true);
    }
}

?>